package com.itheima.dao;

import com.itheima.pojo.Role;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

public interface RoleDao_lzl {
//    /*
//    *根据userId，查询角色role
//    * */
//    @Select("select * from t_user_role ur,t_role r where ur.role_id=r.id and ur.user_id=#{id}")
//    @Results({
//            @Result(id = true,property = "id",column = "id"),
//            @Result(property = "name",column = "name"),
//            @Result(property = "keyword",column = "keyword"),
//            @Result(property = "description",column = "description"),
//
//            @Result(
//                    property = "permissions",
//                    column = "id",
//                    javaType = Set.class,
//                    many = @Many(select = "com.itheima.dao.PermissionDao.findPermissionByRoleId")
//            )
//    })
//    Set<Role> findRoleByUserId(Integer id);

    /*
     * 查詢所有
     * */
    @Select("select * from t_role")
    List<Role> findAll();
}
